Skip to content

fix: mark jobs failed and audit when job payload is invalid JSON - #20

Merged
danishkumar26 merged 1 commit into
mainfrom
fix/issue-19-worker-invalid-payload
Nov 27, 2026
Merged

danishkumar26 merged 1 commit into
mainfrom
fix/issue-19-worker-invalid-payload

Conversation

@danishkumar26

Copy link
Copy Markdown
Owner

Fixes #19.

run_job() let json.loads() of a corrupt job.payload escape uncaught,
crashing the worker and leaving the job stuck in 'running' with no
job.execute.failed audit.

The payload parse and target assessment now run under one failure
handler: any parse or execution error marks the job failed, commits,
writes the job.execute.failed audit entry, and returns
{"job_id": ..., "status": "failed"} so the worker keeps processing
other jobs.

Adds regression test test_run_job_fails_when_payload_is_invalid_json.

Validation: 56/56 pytest pass; ruff check clean; ruff format clean;
mypy app clean.

run_job() let json.loads() of a corrupt job.payload escape uncaught,
crashing the worker and leaving the job stuck in 'running' with no
job.execute.failed audit (issue #19). The payload parse and target
assessment now run under one failure handler: any parse or execution
error marks the job failed, commits, writes the job.execute.failed
audit entry, and returns {"job_id": ..., "status": "failed"} so the
worker keeps processing other jobs.

Adds regression test test_run_job_fails_when_payload_is_invalid_json.

56/56 tests pass; ruff, ruff format, mypy clean.
@danishkumar26
danishkumar26 merged commit 367b629 into main Nov 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

worker.run_job crashes on invalid-JSON job payload, leaving job stuck in 'running'

1 participant